//批量删除

function batDel(url,checkedArr,objArr){
    	if(checkedArr.length!=0){
    		layer.confirm('确认删除？', function(index){
    			
//					objArr.forEach(function(el,index){
//						el.del()
//					})
					layer.close(index);	
					console.log("checkedArr",checkedArr)
					DBHelper.Delete(url,checkedArr,function(data){
						
				      	console.log(data)
				      },function(data){
				      	console.log(data)
				      })
					
		    });
    	}
    }

//最右边工具栏

function toolHandel(detailUrl,delUrl,obj,xqUrl,watchMemUrl,scoreUrl,auditUrl){
    	
			let data = obj.data;//获得当前行数据
			let layEvent = obj.event;
			var tr = obj.tr;
//			console.log(data)
			
			if(layEvent==='detail'){
				if(data.Guid){
					console.log("data",data)
					window.location.href=detailUrl+data.Guid;
				}else {
					console.log("data",data)
					window.location.href=detailUrl+data.Id;
				}
				
			}else if(layEvent==="del"){
				if(data.Guid){
					console.log("data",data.Guid)
					layer.confirm('确认删除？', function(index){
			      obj.del(); //删除对应行（tr）的DOM结构，并更新缓存
			      layer.close(index);
			      //向服务端发送删除指令
			      console.log("data.Guid",data.Guid)
						DBHelper.Delete(delUrl+data.Guid,function(data){
				      	console.log(data)
				     },function(data){
				      	console.log(data)
				      })
			    });
		    	}else if(data.Id){
//		    		console.log("data",data.Id)
					layer.confirm('确认删除？', function(index){
			      obj.del(); //删除对应行（tr）的DOM结构，并更新缓存
			      layer.close(index);
			      //向服务端发送删除指令
			      console.log("data.Guid",data.Id)
						DBHelper.Delete(delUrl+data.Id,function(data){
				      	console.log(data)
				      },function(data){
				      	console.log(data)
				      })
			    });
		    	}
			}else if(layEvent=="xiangqing"){
				window.location.href=xqUrl+data.Guid;
			}else if(layEvent=="watchMem"){
				window.location.href=watchMemUrl+data.Guid;
				console.log("data.Guid",data.Guid)
			}else if(layEvent=="changeScore"){
				if(data.Guid){
					console.log("data.Guid",data.Guid)
					window.location.href=scoreUrl+data.Guid;
				}else if(data.MemLoginId){
					console.log("data.MemLoginId",data.MemLoginId)
					window.location.href=scoreUrl+data.MemLoginId;
				}
				
			}else if(layEvent=="shenhe"){
				console.log(data)
				layer.confirm('确认下架？', function(index){
					let _obj = data;
					_obj.IsAudit = 0;
					DBHelper.Put('Admin_Xn_Product?id='+data.Guid,_obj,function(data){
						console.log(data)
					},function(data){
						console.log(data)
					})
					
					
					layer.close(index);
					window.location.reload();
				})
				
				
			}
		
    }




